﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ARR.Entities.Validation.ComponentModel;
using ARR.Entities.ComponentModel;
using ARR.Entities.Common;
using System.Runtime.Serialization;
using System.ComponentModel;
using ARR.Entities.Validation.Common;
using ARR.Shared;

namespace ARR.Entities.Validation
{
    [Serializable]
    public class StoreInputValidations : InputValidationBase
    {
        private Store store;

        public StoreInputValidations(Store store)
        {
            this.store = store;
        }

        public override List<ValidationBase> CreateValidations()
        {
            List<ValidationBase> inputValidations = new List<ValidationBase>();

            inputValidations.Add(new Required("Name", Labels.Nombre));
            inputValidations.Add(new StringLength("Name", 200, Labels.Nombre));

            inputValidations.Add(new Required("Code", Labels.Codigo));
            inputValidations.Add(new StringLength("Code", 50, Labels.Codigo));

            inputValidations.Add(new StringLength("Region", 100, Labels.Region));
            inputValidations.Add(new StringLength("City", 100, Labels.Ciudad));
            inputValidations.Add(new StringLength("Address", 400, Labels.Direccion));
            inputValidations.Add(new StringLength("Phone", 50, Labels.Telefono));
            inputValidations.Add(new StringLength("Fax", 50, Labels.Fax));
            inputValidations.Add(new StringLength("Format", 100, Labels.Formato));

            inputValidations.Add(new CustomValidation("CountryId", string.Format(Errors.RequiredValidation, Labels.Pais), delegate()
                {
                    return store.CountryId > 0;
                }));

            return inputValidations;
        }
    }
}
